/*
 * Copyright (C) 2009 Yury Kudryashov.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package name.kudryashov.functions;

public class Compose {

    private Compose() {}

    public static <A> ComposableProcedure<A> of(Procedure<A> f) {
        return new ComposableProcedure<A>(f);
    }

    public static <A, R> ComposableFunction<A, R> of(Function<A, R> f) {
        return new ComposableFunction<A,R>(f);
    }

    public static <A1, A2, R> ComposableFunction2<A1, A2, R> of(Function2<A1, A2, R> f) {
        return new ComposableFunction2<A1, A2, R>(f);
    }

    public static <A1, A2, A3, R> ComposableFunction3<A1, A2, A3, R> of(Function3<A1, A2, A3, R> f) {
        return new ComposableFunction3<A1, A2, A3, R>(f);
    }

    public static <A> Predicate<A> not(Predicate<A> f) {
        return new NotPredicate<A>(f);
    }

    public static <A> Predicate<A> and(Predicate<A>... fs) {
        return new AndPredicate<A>(fs);
    }

    public static <A> Predicate<A> or(Predicate<A>... fs) {
        return new OrPredicate<A>(fs);
    }

    public static <A1, A2> ComposablePredicate2<A1, A2> of(Predicate2<A1, A2> f) {
        return new ComposablePredicate2<A1,A2>(f);
    }
}
